<template>
  <div class="mu-select" @click.stop="showOption = !showOption">
    <div class="select" :class="{ action: showOption }">
      <div class="label" :style="{ color: settings.theme }">{{ value }}</div>
      <div class="icon" :style="{ background: settings.theme }">
        <i class="el-icon-arrow-down" />
      </div>
    </div>

    <transition
      name="panel-fade"
      @enter="enter"
      @before-leave="beforeLeave"
      @leave="leave"
    >
      <div class="options" v-show="showOption">
        <div class="op-items">
          <slot></slot>
        </div>
        <div class="op-arrow"></div>
      </div>
    </transition>
  </div>
</template>

<script>
import { mapState } from "vuex";
import animation from "../function/animation";
export default {
  name: "MuSelect",
  componentName: "MuSelect",
  computed: {
    ...mapState(["settings"]),
  },
  data() {
    return {
      value: "搜索",
      showOption: false,
      bodyHeight: 0,
    };
  },
  methods: {
    ...animation,
  },
};
</script>

<style lang="scss" scoped>
@import "../styles/mixin.scss";
@import "./index.scss";
</style>

